package com.ruoyi.yunxin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yunxin.domain.VoiceNotify;
import com.ruoyi.yunxin.service.IVoiceNotifyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 语音通知记录Controller
 * 
 * @author ruoyi
 * @date 2025-04-10
 */
@RestController
@RequestMapping("/voiceNotify/voiceNotify")
public class VoiceNotifyController extends BaseController
{
    @Autowired
    private IVoiceNotifyService voiceNotifyService;

    /**
     * 查询语音通知记录列表
     */
    @PreAuthorize("@ss.hasPermi('voiceNotify:voiceNotify:list')")
    @GetMapping("/list")
    public TableDataInfo list(VoiceNotify voiceNotify)
    {
        startPage();
        List<VoiceNotify> list = voiceNotifyService.selectVoiceNotifyList(voiceNotify);
        return getDataTable(list);
    }

    /**
     * 导出语音通知记录列表
     */
    @PreAuthorize("@ss.hasPermi('voiceNotify:voiceNotify:export')")
    @Log(title = "语音通知记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VoiceNotify voiceNotify)
    {
        List<VoiceNotify> list = voiceNotifyService.selectVoiceNotifyList(voiceNotify);
        ExcelUtil<VoiceNotify> util = new ExcelUtil<VoiceNotify>(VoiceNotify.class);
        util.exportExcel(response, list, "语音通知记录数据");
    }

    /**
     * 获取语音通知记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('voiceNotify:voiceNotify:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(voiceNotifyService.selectVoiceNotifyById(id));
    }

    /**
     * 新增语音通知记录
     */
    @PreAuthorize("@ss.hasPermi('voiceNotify:voiceNotify:add')")
    @Log(title = "语音通知记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VoiceNotify voiceNotify)
    {
        return toAjax(voiceNotifyService.insertVoiceNotify(voiceNotify));
    }

    /**
     * 修改语音通知记录
     */
    @PreAuthorize("@ss.hasPermi('voiceNotify:voiceNotify:edit')")
    @Log(title = "语音通知记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VoiceNotify voiceNotify)
    {
        return toAjax(voiceNotifyService.updateVoiceNotify(voiceNotify));
    }

    /**
     * 删除语音通知记录
     */
    @PreAuthorize("@ss.hasPermi('voiceNotify:voiceNotify:remove')")
    @Log(title = "语音通知记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(voiceNotifyService.deleteVoiceNotifyByIds(ids));
    }
}
